package com.frxuexi.soufang

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import androidx.recyclerview.widget.LinearLayoutManager
import com.alibaba.android.arouter.facade.annotation.Route
import com.frxuexi.adapter.MyHourseAdapter
import com.frxuexi.lib_base.mvvm.BaseActivity
import com.frxuexi.soufang.databinding.ActivityHoursescBinding
import dagger.hilt.android.AndroidEntryPoint

@Route(path = "/soufang/HoursescActivity")
@AndroidEntryPoint
class HoursescActivity : BaseActivity<ActivityHoursescBinding,HourseViewModel>() {
    val myHourseAdapter by lazy { MyHourseAdapter() }
    override fun initData() {
        vm.selectHourseSuc.observe(this){
            Log.i("===",it.toString())
            myHourseAdapter.addData(it)
            myHourseAdapter.notifyDataSetChanged()
        }
    }

    override fun initView() {
        binding.rvMyhourse.apply {
            adapter=myHourseAdapter
            layoutManager=LinearLayoutManager(this@HoursescActivity)
        }
        vm.selectHourse()
    }

}